
#include <stdio.h>
#include <windows.h>
#include "mongoose.h"


int main()
{
	char path[256];
	GetCurrentDirectory(256, path);

    struct mg_context *ctx;
    ctx = mg_start();

	mg_set_option(ctx, "ports",       "80");
	mg_set_option(ctx, "max_threads", "10");
	mg_set_option(ctx, "auth_realm",  "xxx.com");
	mg_set_option(ctx, "index_files", "index.htm");

	mg_modify_passwords_file(ctx, "pass.txt", "atto", "passme");
	mg_modify_passwords_file(ctx, "pass.in", "atto", "passin");

	mg_set_option(ctx, "root",        path);
	mg_set_option(ctx, "auth_gpass",  "pass.txt");
	mg_set_option(ctx, "access_log",  "access.log");
	mg_set_option(ctx, "error_log",   "error.log");

	mg_set_option(ctx, "protect",   "/inner.htm=pass.in");

	printf("Mongoose %s started on port(s) [%s], directory [%s]\n",
	    mg_version(),
	    mg_get_option(ctx, "ports"),
	    mg_get_option(ctx, "root"));

    while (getchar() != 'q');

    mg_stop(ctx);
    return 0;
}

